PreviousNextTracker indexSee it online !

(47/185) 115 - Beauty Plugin: Generic code reformatter

Because jEdit supports a lot of languages, and actually the beautifier plugins availlable only work with Java or C. I, for example, work with ActionScript and a code beautifier is a must specially for larger files.
Thanks in advance.

Submitted oxk4r - 2009-01-29 15:57:10 Assigned
Priority 8 Labels
Status open Group None
Resolution None

Comments

2009-01-30 02:07:19
daleanson

Arg. I realized after reading your request that this feature has been in the Beauty plugin for about a year and a half, but apparently, I never got around to completing the feature or documenting it. Would you see if this fits your needs:

Install the Beauty plugin from Plugin Manager.

Go to Utilities - BeanShell - Evaluate BeanShell Expression, then enter this in the dialog:

jEdit.setBooleanProperty("beauty.useBuiltInIndenter", true)

Then open one of your ActionScript file, and then Plugins - Beauty - Beautify Buffer.

The "built in indenter" uses the mode of the current buffer and uses the indenting defined in the buffer to indent the buffer, so if the mode file is good, your indenting should come out pretty well too. The not completed part is I never added a checkbox to the plugin options to let the user turn this feature on.

2009-01-30 09:17:34
oxk4r

- **priority**: 5 --> 8

2009-01-30 09:17:34
oxk4r

Hi, deleanson, I have that plugins installed (and the AStyle Beautifier plugin too) but, it doesn't format the ActionScript code correctly. I have uploaded three captures to explain it. The first capture is the code correctly fomatted, the second is a capture after perform a format with Beauty (I highlighted the errors), and the third is the result for the second format: the lines become separated, and if more formats are performed this separation becomes greater every time. Moreover, if I choose java:beauty or javacc:beauty in the plugin options, then i get an error (see capture "Beauty Error").


2009-01-30 09:40:52
oxk4r

Beauty%20Error.jpg (21.7Kio)

2009-01-30 09:45:47
oxk4r

01CorrectlyFormattedCode.jpg (69.1Kio)

2009-01-30 09:46:07
oxk4r

02AfterBeauty.jpg (68.4Kio)

2009-01-30 09:46:20
oxk4r

03AfterBeautySecondTime.jpg (44.1Kio)

2009-01-30 09:53:33
admirau

And what about formatting PHP code?
A style does not format PHPDoc comments correctly, PHP5…

(Now I do that by running PEAR’s PHP Beautifier from the console).

2009-02-07 20:42:09
*anonymous

Shouldn't this be in the Plugin Feature Requests tracker? As far as I know, the core does not have a definition of coding style, this task is therefore left for plugins. If the request is to add such beautifiers for the Beautify plugin, this request should move the Plugin Feature Requests tracker.
If the request is to have a reformatting capability in the core, a good reason for that should be specified and then this request should be left here. Here's one such possible reason, but I'm not sure it's worth the effort:
While a "beautify buffer" action is definitely helpful, an "on the fly" beautifier is also helpful - one that beautifies the buffer as I type, so I can type a long line without caring about indentation and lines breaks (to some extent) and have the beautifier take care of that for me as I type. The functionality of an "on the fly" beautifier can be defined as running the beautifier on each change in the buffer (e.g. character insertion, line removal, and so on), while maintaining the caret location correctly.

2009-02-14 04:55:49
ezust

- **labels**: 871559 -->
- **summary**: Generic code reformatter --> Beauty Plugin: Generic code reformatter

2009-02-14 04:55:49
ezust

moving to plugin feature requests, and adding Beauty Plugin in the subject line.